package com.newlink.building.userinfo.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.newlink.building.common_base.model.bean.PropertyManagerData
import com.newlink.building.userinfo.R

/**
 * @author wangyang
 * @date 2022/9/16
 * @description 我的——家庭管理页面的Adapter
 */
class Module_UserInfo_PropertyManagementAdapter(data: MutableList<PropertyManagerData>) :
    BaseQuickAdapter<PropertyManagerData, BaseViewHolder>(
        R.layout.item_property_management,
        data
    ), LoadMoreModule {

    init {
        addChildClickViewIds(R.id.iv_call)
    }

    override fun convert(holder: BaseViewHolder, item: PropertyManagerData) {
        holder.setText(R.id.tv_name, item.name)
        holder.setText(R.id.tv_number, item.aid.toString())
//        val num = if (item.aid.toString().trim() == "0"  && item.appStatus == 1) {
//            ""
//        } else {
//            item.aid.toString()
//        }
//
//        holder.setText(R.id.tv_number, num)
//
//        when (item.appStatus) {
//            1 -> {
//                //等待激活
//                holder.getView<TextView>(R.id.tv_state).visibility = View.VISIBLE
//                holder.getView<ImageView>(R.id.iv_call).visibility = View.GONE
//                holder.getView<LinearLayout>(R.id.ll_shade).visibility = View.GONE
//                holder.setText(
//                    R.id.tv_state,
//                    context.resources.getString(R.string.family_management_state_wait_activation)
//                )
//                holder.setTextColor(R.id.tv_state, context.getColor(R.color.default_red))
//            }
//            2 -> {
//                //已激活
//                holder.getView<TextView>(R.id.tv_state).visibility = View.GONE
//                holder.getView<ImageView>(R.id.iv_call).visibility = View.GONE
//                holder.getView<LinearLayout>(R.id.ll_shade).visibility = View.GONE
//                holder.setTextColor(R.id.tv_state, context.getColor(R.color.default_text))
//            }
//            else -> {
//                holder.getView<TextView>(R.id.tv_state).visibility = View.VISIBLE
//                holder.getView<ImageView>(R.id.iv_call).visibility = View.GONE
//                holder.getView<LinearLayout>(R.id.ll_shade).visibility = View.VISIBLE
//                holder.setText(
//                    R.id.tv_state,
//                    context.resources.getString(R.string.family_management_state_unknow)
//                )
//                holder.setTextColor(R.id.tv_state, context.getColor(R.color.default_yellow))
//            }
//        }
    }
}